﻿/* 
 * BtCommLib - the OpenWebNet .NET Library
 *
 * Copyright (C) 2011 BTicino S.p.A.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BTicino.BtCommLib.Communication
{
    /// <summary>
    /// This class is design to contain BTicino channel information (eg. MONITOR PORT, COMMAND PORT, ecc...)
    /// </summary>
    public class BTCommChanPar
    {
        # region data_member

        private Dictionary<string, string> m_connPar;
        private Dictionary<string, string> m_mediaPar;
        
        #endregion

        #region constructor

        /// <summary>
        /// Empty constructor
        /// </summary>
        public BTCommChanPar()
        {
            m_connPar    = new Dictionary<string, string>(0);
            m_mediaPar  = new Dictionary<string, string>(0);
        }

        #endregion

        #region Get / Set
        /// <summary>
        /// BTicino port setter
        /// </summary>
        /// <param name="theName">Port name</param>
        /// <param name="theVal">Port value</param>
        public void setConnPar(string theName, string theVal)
        {
            m_connPar.Add(theName, theVal);
        }


        public void setMediaPar(string theName, string theVal)
        {
            m_mediaPar.Add(theName, theVal);
        }

        /// <summary>
        /// BTicino Port getter
        /// </summary>
        /// <param name="theName">Port name</param>
        /// <returns>Port Value (string)</returns>
        public string getConnPar(string theName) 
        {
            try
            {
                return (m_connPar[theName]);
            }
            catch (KeyNotFoundException)
            {
                return ("");
            }
        }


        public string getMediaPar(string theName)
        {
            try
            {
                return (m_mediaPar[theName]);
            }
            catch (KeyNotFoundException)
            {
                return ("");
            }
        }

        #endregion
    }
}
